package com.wzq.util;

/**
 * 状态码枚举类
 * 
 * @author OEasy
 *
 */
public enum ResponseCode {
    SUCC("200", "ok"), 
    PARAM_ERR("400", "请求参数错误"), 
    TOKEN_INVALID("403", "token无效,你没有权限访问"), 
    DID_INVALID("405","did无效,你没有权限访问"),
    NOT_FOUND("404", "请求地址不存在"), 
    METHOD_NOT_ALLOWED("405", "http请求Method错误"),
    EMP("430", "参数为空"), 
    EXIST("431", "数据已存在"), 
    NOT_EXI("432", "数据不存在"), 
    SIGN_ERR("433", "签名错误"), 
    CAPTCHA_ERR("434", "验证码错误"),
    NOT_EXI_USER("435", "用户不存在"),
    USER_OR_PWD_ERROR("436", "用户或密码错误"),
    ERR("500", "系统错误");
    
	// 成员变量
	private String code;
	private String message;

	// 构造方法
	private ResponseCode(String code, String message) {
		this.code = code;
		this.message = message;
	}

	// 普通方法
	public static String getMessage(String code) {
		for (ResponseCode c : ResponseCode.values()) {
			if (c.getCode() == code) {
				return c.getMessage();
			}
		}
		return null;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
